home *** CD-ROM | disk | FTP | other *** search
- Path: news.sinet.slb.com!usenet
- From: "Vinh D. Nguyen" <vnguyen@sugar-land.anadrill.slb.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Q: default copy constructor
- Date: Tue, 12 Mar 1996 18:03:19 -0600
- Organization: Schlumberger Anadrill
- Message-ID: <314610C7.5BB4@sugar-land.anadrill.slb.com>
- References: <4i49tj$991@azure.acsu.buffalo.edu>
- NNTP-Posting-Host: 163.185.118.40
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- Li Chen wrote:
- >
- > Hi, everyone:
- >
- > Ihave a question:does a C++ compiler generate copy constructor
- > if there is none in the program?
- >
- > Thank you.
- >
- > David
- >
- > --
- > ___________________________________________________________________________
- > ---------------------------------------------------------------------------
- >
- > David Li Chen
-
- Yes, but the compiler will generate only a shallow copy constructor. That is,
- suppose A contains a pointer to C, after B = A, B points to the same C object.
- This may create a problem because if A destroys C upon its own destruction
- then B would point to an object that no longer exists.
-
- --
- --------------------------------------------------------------------------
- * Vinh Nguyen vnguyen@slb.com *
- * Drilling Information Products - Senior Engineer *
- * Anadrill Schlumberger *
- * 200 Gillingham Ln. (713) 275-7524 (Office) *
- * Sugarland, TX 77478 (713) 275-8098 (FAX) *
- --------------------------------------------------------------------------
-